import { request } from '@/framework/utils/request-jdz';

// 请求入库结果
export const getStorageInfoById = (id) => {
  return request(
    {
      url: `/bill-in/${id}/billInfo`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 盘点单号
export const getBatchNo = () => {
  return request(
    {
      url: `/bill-inventory/generate/batch-no`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 获取指定盘点单详情信息
export const getInventoryDetail = (id) => {
  return request(
    {
      url: `/bill-inventory/${id}/detail`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

/**
 * 获取盘点单
 */
// 系统推荐选择盘点库存
export const getSelectRandom = (params) => {
  return request(
    {
      url: '/bill-inventory/select-random',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 全部选择盘点库存
export const getSelectAll = (params) => {
  return request(
    {
      url: '/bill-inventory/select-all',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

/**
 * 盘点单操作
 */
// 盘点单-创建
export const createInventory = (data) => {
  return request(
    {
      url: '/bill-inventory',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 盘点单-提交
export const submitInventory = (data) => {
  return request(
    {
      url: '/bill-inventory',
      method: 'patch',
      data: data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 盘点单—列表查询
export const inventorySearch = (params) => {
  return request(
    {
      url: '/bill-inventory',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
// 盘点单—删除
export const delInventory = (id) => {
  return request(
    {
      url: `/bill-inventory/${id}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 盘点单-调整
export const inventoryFix = (data) => {
  return request(
    {
      url: '/bill-inventory/fix',
      method: 'patch',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

// 删除盘点单信息
export const delFile = (id) => {
  return request({
    url: `/file/${id}`,
    method: 'delete',
  });
};
